package com.qf.blog.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qf.blog.dto.CommentDto;
import com.qf.blog.dto.IndexDiscussPostDto;
import com.qf.blog.dto.MyPage;
import com.qf.blog.entity.DiscussPost;
import com.qf.blog.vo.DiscussPostVo;
import com.qf.blog.vo.Topic;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * User: key
 * ClassName:DiscussPost
 * Date: 2023/6/3
 * Time: 17:10
 * description:
 */
@Mapper
public interface DiscussPostMapper extends BaseMapper<DiscussPost> {
    public MyPage<IndexDiscussPostDto> indexPostDataPageVo(@Param("page") IPage<IndexDiscussPostDto> page, @Param("orderMode") Integer orderMode);
    public MyPage<IndexDiscussPostDto> indexPostDataPageVoSearch(@Param("page") IPage<IndexDiscussPostDto> page,
                                                           @Param("orderMode") Integer orderMode,
                                                           @Param("keyword") String keyword);
    public MyPage<IndexDiscussPostDto> indexPostDataPageVoPerson(@Param("page") IPage<IndexDiscussPostDto> page,
                                                           @Param("orderMode") Integer orderMode,
                                                           @Param("entityId") Integer entityId);

    List<CommentDto> getCommentListByPostId(Integer id);


    List<IndexDiscussPostDto> adminPostList();

    @Update("update discuss_post set type = #{type} where id = #{id}")
    Integer updatePostType(@Param("id") Integer id, @Param("type") Integer type);

    @Update("update discuss_post set status = #{status} where id = #{id}")
    Integer updatePostStatus(@Param("id") Integer id, @Param("status") Integer status);

    Integer publishDiscuss(@Param(value = "publish") DiscussPostVo discussPostVo);
    MyPage discussPage(MyPage page);
    DiscussPost getall();

    Topic detail(Integer id);
}
